package com.echo.code.spring.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import java.util.Collections;

/**
 * Description
 *
 * @author baiyp
 * @version 1.0.0
 * @date 2019/04/21
 */
@Configuration
@Import(StudentConfig.class)
public class TeacherConfig {

  @Autowired
  private StudentConfig studentConfig;

  @Bean
  public Teacher teacher() {
    Teacher teacher = new Teacher();
    teacher.setName("Mary");
    teacher.setSalary(9000.00);
    teacher.setStudents(Collections.singleton(studentConfig.student()));
    return teacher;
  }
}
